This application is based on application(s) No(s). 10-237080 and 10-240046 filed in Japan, the contents of which are hereby incorporated by reference.
The present invention generally relates to a color image processing method and apparatus and particularly, to a method and apparatus for dividing a color image into regions, which method is used for shape extraction in an image retrieval process or the like. The present invention also relates to storage media that store information processing programs for carrying out such dividing method.
Conventionally, in executing color image retrieval, a process of dividing an image into regions has been executed as a preprocessing for extracting the shape of an object or objects in the image to be used as a retrieval condition. However, with regard to color images taken in from a digital camera or a scanner, it is sometimes the case that the background, which seems to have a single color at a glance, is not monochrome on the pixel-value basis or that the background has a color close to that of an object in the image. In the case of such color images, in order to remove the background from the image with high accuracy through simple fixed color classification or to divide the image into a plurality of regions, it is required to finely classify the colors and divide the image into very small regions and thereafter integrate or unite some of the very small regions into a larger region through some determining calculations. This leads to a first problem that much processing time is consumed.
On the other hand, in the case of natural images such as landscape images, the background of, for example, sky or sea has a gradation, and objects included in the image have shades. For this reason, if such an image is divided into a plurality of regions simply by colors, it is very possible that a single background, region having a gradation and a single object region having shades is erroneously extracted as a plurality of regions. This is a second problem.
An object of the present invention is to solve the first problem and provide a color image dividing method capable of reducing the processing time and executing the division of a color image into appropriate regions with high accuracy regardless of the magnitude of change in color of the image, as well as an apparatus that carries out the method and a program storage medium storing a program for carrying out such a method.
Another object of the present invention is to solve the second problem and provide a color image diving method including a region integrating step, which is capable of extracting regions of an object having gradation and shade as one region, as well as an apparatus that carries out the method and a program storage medium storing a program for carrying out such a method.
In order to accomplish the first object, the present invention provides a method of dividing a color image into regions, comprising the steps of:
calculating color differences between pixels of the color image;
determining widths of division in directions of axes of a color space on the basis of the color differences between the pixels;
setting color classification numbers for respective color space regions into which the color space has been divided according to the widths of division in the directions of the axes;
labeling each pixel of the color image with the color classification number of a corresponding color space region in which a color of the pixel is included; and
dividing the color image into same-color regions based on the color classification numbers of the labeled pixels, wherein when consecutive labeled pixels have a same classification number, those pixels are determined to constitute one same-color region.
With this method, the color image is divided into concolorous, or same-color regions corresponding to the regions of the color space, which is an HLS color space, for example. This obviates the need of segmenting the image into fine fractions through the precise classification of colors, and then integrating or combining some or all of the fractions into a single region.
The present invention also provides a program storage medium which stores an information processing program comprising all the steps of the above method of the invention.
The method can be carried out by, for example, an image processing device according to one aspect of the invention, which comprises:
a memory for storing data of a color image;
a setting section which determines widths of division in directions of axes of a color space on the basis of color differences between pixels of the color image stored in the memory, and sets a color classification number for each of color space regions into which the color space has been divided according to the widths of division; and
a processing section which labels each pixel of the color image stored in the memory with the color classification number of a corresponding color space region in which a color of the pixel is included.
In one embodiment, the image processing device further comprises a dividing section which divides the color image into regions based on the color classification numbers of the labeled pixels, wherein when consecutive labeled pixels have a same classification number, those pixels are determined to constitute one region.
Furthermore, in order to accomplish the second object, the present invention provides a method of dividing a color image into regions, comprising the steps of:
dividing a color image into regions based on color information of the color image;
calculating a gradation region-determining criterion based on color differences between pixels of the color image; and
integrating consecutive regions among all the regions of the color image with one another when these consecutive regions are judged to constitute one gradation region, wherein judgement whether or not the consecutive regions constitute a gradation region is done based on the gradation region-determining criterion and continuity of color change at each of boundaries between the consecutive regions.
With this second method of the invention, a region including gradation and shade in the image can be extracted as a single region, and not as a plurality of regions.
The present invention also provides a program storage medium which stores an information processing program comprising all of the steps that the second method of the invention comprises.
The second method can be carried out by an image processing device according to one aspect of the invention, which comprises:
a memory for storing data of a multiplicity of regions into which a color image has been divided based on color information of the color image;
a setting section which determines a criterion used for judging whether adjacent regions among the multiplicity of regions constitute a gradation region, based on color differences between pixels of the color image; and
a processing section which integrates the adjacent regions when judging the adjacent regions to be a gradation region based on the criterion set by the setting section and continuity of color change at each of boundaries between the adjacent regions.